﻿#include<stdio.h>
#include<conio.h>
//struct
struct PROCESS
{	
	int ten,tgs,tgr,tgp;	
};
struct INPUT
{
	int sop;
	struct PROCESS pro[100];	
	int gt;
};
struct OUTPUT
{
	int sche[100];
	int wtime[100];
	int ns,nw;	
	float avgtime;
};
struct QUEUE
{
	int dau,cuoi;
	int hd[100];
};

void Input(struct INPUT *inp)
{	
	//struct INPUT inp;
	struct PROCESS p;	
	int i;
	FILE *f;
	// mo file
	f = fopen("CPU.txt","rt");
	//lay so process
	fscanf(f,"%d",&inp->sop);	
	//lay cac thong so cua process
	for(i=0;i<inp->sop;i++)
	{			
		fscanf(f,"%d",&p.ten);
		fscanf(f,"%d",&p.tgs);
		fscanf(f,"%d",&p.tgr);
		fscanf(f,"%d",&p.tgp);
		inp->pro[i]=p;
	}
	//lay pp gt -1: SJF-non 0:SJF >0: q cua RRB
	fscanf(f,"%d",&inp->gt);		
	fclose(f);
}
//output
void Output(struct OUTPUT out)
{
}
//schedule
struct OUTPUT SJF(struct INPUT input){
	
}

//main
void main(){
	int i;
	struct INPUT inp;
	struct OUTPUT out;
	Input(&inp); 	
	if(inp.gt>0) out = RRB(inp);
	else out = SJF(inp);		
	Output(out);
	getch();
}
